/**
 * Created by shi.pengyan on 2016-10-30.
 */

// show: meta.label -> name
// name: component name
// meta.label: display label

// lazy loading Components
// https://github.com/vuejs/vue-router/blob/dev/examples/lazy-loading/app.js#L8

// this is for webpack2
const lazyLoading = (path, index = false) => () => System.import(`module/${path}${index ? '/index' : ''}.vue`)

// this is for webpack1
// const lazyLoading = (path, index = false) => resolve => {
//  let fileName = `${basePath}${path}${index ? '/index' : ''}.vue`
//  const nickName = fileName.replace(/\//g, '_')
//
//  require.ensure([], () => resolve(require(fileName)), nickName)
// }


// 路由定义
// 从服务器加载菜单选项

export default [
  {
    name: 'Dashboard',
    path: '/dashboard',
    meta: {icon: 'fa-tachometer'},
    component: lazyLoading('common/dashboard')
  },
  {
    name: 'User',
    path: '/user/index',
    component: lazyLoading('user/user')
  },
  {
    name: 'User Add',
    path: '/user/add',
    component: lazyLoading('user/userAdd')
  },
  {
    name: 'Role',
    path: '/role/index',
    component: lazyLoading('role/role')
  }, {
    name: 'Role Add',
    path: '/role/add',
    component: lazyLoading('role/roleAdd')
  },
  {
    name: 'Priv',
    path: '/priv/index',
    component: lazyLoading('privilege/priv')
  },
  {
    name: 'Priv Add',
    path: '/priv/add',
    component: lazyLoading('privilege/privAdd')
  },
  {
    name: 'Parameter',
    path: '/param/index',
    component: lazyLoading('param/param')
  },
  {
    name: 'Cache',
    path: '/cache/index',
    component: lazyLoading('cache/cache')
  },
  {
    name: 'JobService',
    path: '/jobservice/index',
    component: lazyLoading('jobservice/jobservice')
  },
  {
    name: 'AppMgr',
    path: '/appversion/app',
    component: lazyLoading('appversion/app')
  },
  {
    name: 'App Version',
    path: '/appversion/index',
    component: lazyLoading('appversion/appVersion')
  },
  {
    name: 'Log Audit',
    path: '/logAudit/index',
    component: lazyLoading('logAudit/index')
  },
  {
    name: 'File Upload',
    path: '/fileUpload/index',
    component: lazyLoading('fileUpload/index')
  },
  {
    name: 'Banner',
    path: '/banner/index',
    component: lazyLoading('banner/banner')
  },
  {
    name: 'OrganBao',
    path: '/organBao/index',
    component: lazyLoading('organBao/organBao')
  },
  {
    name: 'Picture',
    path: '/pictureUpload/index',
    component: lazyLoading('pictureUpload/index')
  },
  {
    name: 'FundInfo',
    path: '/fundInfo/index',
    component: lazyLoading('fundInfo/fundInfo')
  },
  {
    name: 'OperationContent',
    path: '/operationContent/index',
    component: lazyLoading('operationContent/operationContent')
  },

  //TODO 项目化时请删除此模块
  {
    name: 'Bulletin',
    path: '/bulletin/index',
    component: lazyLoading('bulletin/bulletin')
  },
  {
    name: 'BulletinForm',
    path: '/bulletin/add',
    component: lazyLoading('bulletin/bulletinForm')
  },
  {
    name: 'Group',
    path: '/group/index',
    component: lazyLoading('group/group')
  },
  {
    name: 'Test',
    path: '/test/index',
    component: lazyLoading('test/index')
  },
  {
    name: 'Test2',
    path: '/test/index2',
    component: lazyLoading('test/index2')
  },
  {
    name: 'Appointments',
    path: '/appointments/index',
    component: lazyLoading('appointments/appointments')
  },
  {
    name: 'NewsBroadcast',
    path: '/newsBroadcast/index',
    component: lazyLoading('newsBroadcast/index')
  },
  {
    name: 'News Add',
    path: '/newsBroadcast/add',
    component: lazyLoading('newsBroadcast/newsAdd')
  },
  {
    name: 'Fund Lesson',
    path: '/fundlesson/index',
    component: lazyLoading('fundLesson/index')
  },
  {
    name: 'Lesson Add',
    path: '/fundLesson/add',
    component: lazyLoading('fundLesson/lessonAdd')
  },
  {
    name: 'Affiche',
    path: '/affiche/index',
    component: lazyLoading('affiche/index')
  },
  {
    name: 'Affiche Add',
    path: '/affiche/add',
    component: lazyLoading('affiche/afficheAdd')
  },
  {
    name: 'Spider',
    path: '/spider/index',
    component: lazyLoading('spider/index')
  },
  {
    name: 'photoshow_test',
    path: '/photoshow_test/index',
    component: lazyLoading('photoshow_test/index')
  },
  {
    name: 'invitation',
    path: '/invitation/index',
    component: lazyLoading('invitation/index')
  },
  {
    name: 'suggestion',
    path: '/suggestion/index',
    component: lazyLoading('suggestion/index')
  },
  {
    name: 'fundPortfolio',
    path: '/fundPortfolio/index',
    component: lazyLoading('fundPortfolio/index')
  },
  {
    name: 'fundPortfolio Add',
    path: '/fundPortfolio/add',
    component: lazyLoading('fundPortfolio/indexForm')
  },
  {
    name: 'fundPortfolio AddHistory',
    path: '/fundPortfolio/addhistory',
    component: lazyLoading('fundPortfolioHistory/index')
  },
  // {
  //   name: 'fundPortfolio AddHistory',
  //   path: '/fundPortfolioHistory/index',
  //   component: lazyLoading('fundPortfolioHistory/index')
  // },
  {
    name: 'bankQuota',
    path: '/bankQuota/index',
    component: lazyLoading('bankQuota/index')
  },
  {
    name: 'fundRecommend',
    path: '/fundRecommend/index',
    component: lazyLoading('fundRecommend/index')
  },
  {
    name: 'wareHouse',
    path: '/wareHouse/index',
    component: lazyLoading('wareHouse/index')
  },
  {
    name: 'wareHouse add',
    path: '/wareHouse/add',
    component: lazyLoading('wareHouse/add')
  },
  {
    name: 'operator',
    path: '/operator/index',
    component: lazyLoading('operator/index')
  },
  {
    name: 'bankManagement',
    path: '/bankManagement/index',
    component: lazyLoading('bankManagement/index')
  }
]

